package test.implementationOmitted;

import dk.au.cs.peterbn.annotations.Member;
import dk.au.cs.peterbn.annotations.Pattern;

import java.util.HashSet;
import java.util.Set;

/**
 * Created by IntelliJ IDEA.
 * User: peter
 * Date: 9/12/11
 * Time: 11:33 AM
 * To change this template use File | Settings | File Templates.
 */
@Pattern(id = "test.implementationOmitted", name = "gof:Observer", role = "Subject")
public abstract class ASubject {

    Set<AObserver> observers = new HashSet<AObserver>();

    @Member(id = "test.implementationOmitted", role = "Attach")
    public void attach(AObserver observer) {
        //To change body of implemented methods use File | Settings | File Templates.
    }

    @Member(id = "test.implementationOmitted", role = "Detach")
    public void detach(AObserver observer) {
        //To change body of implemented methods use File | Settings | File Templates.
    }

    @Member(id = "test.implementationOmitted", role = "Notify")
    public void notifyObservers() {
        for (AObserver observer : observers) {
            observer.update();
        }
        //To change body of implemented methods use File | Settings | File Templates.
    }
}
